-- 菜单SQL${name}
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES ('${menuId}', '${pid}', 1, '${name}', NULL,
'${route_path}', '/${component_path}', '${perm}:query', NULL, NULL, NULL, 1, 0, 1, 1, 1, 1, 1,
NULL, NULL, NULL, 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

-- 新增${name}
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${addId}, '${menuId}', 2, '新增${name}', NULL,
NULL, NULL, '${perm}:add', NULL, 1, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

<#if layout?? && layout == "treeTable">
-- 新增下级${name}
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${childId}, '${menuId}', 2, '新增${name}下级', NULL,
NULL, NULL, '${perm}:child', NULL, 1, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);
</#if>

-- 编辑${name}
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${editId}, '${menuId}', 2, '编辑${name}', NULL,
NULL, NULL, '${perm}:edit', NULL, 2, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

-- 删除${name}
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${delId}, '${menuId}', 2, '删除${name}', NULL,
NULL, NULL, '${perm}:del', NULL, 3, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

<#if layout?? && layout != "treeTable">
-- 批量删除${name}
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${batchDelId}, '${menuId}', 2, '批量删除${name}', NULL,
NULL, NULL, '${perm}:batchDel', NULL, 4, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);
</#if>

-- 查询${name}（单个）
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${queryId}, '${menuId}', 2, '查询${name}（单个）', NULL,
NULL, NULL, '${perm}:queryById', NULL, 5, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

-- 更多按钮
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${moreId}, '${menuId}', 2, '更多按钮', NULL,
NULL, NULL, '${perm}:more', NULL, 6, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

-- 详情按钮
INSERT INTO sys_permission (`id`, `pid`, `type`, `name`, `icon`, `route_path`, `component_path`, `perms`,
`query`, `sort_rank`, `remark`, `is_leaf`, `is_keep_alive`, `is_hide_in_menu`, `is_hide_in_tab`,
`is_hide_in_breadcrumb`, `is_hide_children_in_menu`, `is_badge`, `badge_value`, `badge_type`,
`badge_variants`, `is_affix_tab`, `affix_tab_order`, `is_link`, `link_open_way`, `link`,
`authority_str`, `is_menu_visible_with_forbidden`, `open_in_new_window`, `create_time`,
`create_by`, `update_by`, `update_time`, `del_flag`)
VALUES (${detailsId}, '${menuId}', 2, '详情按钮', NULL,
NULL, NULL, '${perm}:details', NULL, 7, NULL, 0, 0, 1, 1, 1, 1, 1,
NULL, 'dot', 'success', 1, 0, 1, 0, NULL, NULL, 1, 1, NOW(), 'super', NULL, NULL, 0);

<#if isAuth?? && isAuth == 0>
-- 授权:[${auths}]
INSERT INTO sys_role_permission (
id, role_id, permission_id, create_by, create_time, update_by, update_time, del_flag
) VALUES
('${authMenuId}', '${auths}', '${menuId}', 'super', NOW(), NULL, NULL, 0),
('${authAddId}', '${auths}', '${addId}', 'super', NOW(), NULL, NULL, 0),
<#if layout?? && layout == "treeTable">
('${authAddChildId}', '${auths}', '${childId}', 'super', NOW(), NULL, NULL, 0),
</#if>
('${authEditId}', '${auths}', '${editId}', 'super', NOW(), NULL, NULL, 0),
('${authDelId}', '${auths}', '${delId}', 'super', NOW(), NULL, NULL, 0),
<#if layout?? && layout != "treeTable">
('${authBatchDelId}', '${auths}', '${batchDelId}', 'super', NOW(), NULL, NULL, 0),
</#if>
('${authQueryById}', '${auths}', '${queryId}', 'super', NOW(), NULL, NULL, 0),
('${authMoreId}', '${auths}', '${moreId}', 'super', NOW(), NULL, NULL, 0),
('${authDetailsId}', '${auths}', '${detailsId}', 'super', NOW(), NULL, NULL, 0);
</#if>
